Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Pass correct mode string to phpseclib#50

Open
suneth-perera wants to merge 2 commits intonov:masterfrom
suneth-perera:master
Open

Pass correct mode string to phpseclib#50
suneth-perera wants to merge 2 commits intonov:masterfrom
suneth-perera:master

Conversation

@suneth-perera
Copy link

  • In the current process in cipher() method in JWE.php its $cipher = new AES(AES::MODE_CBC); where AES::MODE_CBC will be '2'.
  • and according to the SymmetricKey.php constructor code shown below expects $mode to be a string. As the current code is passing 2, it endsup throw new BadModeException('No valid mode has been specified');

$mode = strtolower($mode);
// necessary because of 5.6 compatibility; we can't do isset(self::MODE_MAP[$mode]) in 5.6
$map = self::MODE_MAP;
if (!isset($map[$mode])) {
throw new BadModeException('No valid mode has been specified');
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant